﻿using LeRenard.ScriptWars.Model.Scripting;
using LeRenard.ScriptWars.Model.Scripting.Definitions;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace LeRenard.ScriptWars.Model.Tests.Scripting.Definitions
{
    public class OperationDefinitionRepositoryTests
    {
        [Fact]
        public void Contains_Correct_Operations()
        {
            // Arrange
            // Act
            var expected = new string[]{
                "MOVE", "TURN", "RANDOM", "GOTO"
            }.OrderBy(s => s);
            var actual = OperationDefinitionRepository.OperationDefinitions
                .Select(o => o.Name)
                .OrderBy(s => s);
            
            // Assert            
            Assert.Equal(expected.Count(), actual.Count());
            foreach (var expectedOperationName in expected) {
                Assert.True(actual.Contains(expectedOperationName));
            }
        }        
    }
}
